package com.SouthernWall_404.AgeDust.Common.Network.ClientHandler;

import com.SouthernWall_404.AgeDust.Client.Gui.Screen.EditScreen.CharacterEditScreen;
import com.SouthernWall_404.AgeDust.Common.API.Info.AttributesInfo;
import com.SouthernWall_404.AgeDust.Common.API.Info.CharacterInfo;
import com.SouthernWall_404.AgeDust.Common.Network.S2C.CharacterScreenServerPacket;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.minecraftforge.network.NetworkEvent;

import java.util.function.Supplier;

public class CharacterClientHandler {
    public static void handleOpenPacket(CharacterScreenServerPacket msg, Supplier<NetworkEvent.Context> ctx)
    {
        Minecraft minecraft=Minecraft.getInstance();

        CharacterInfo characterInfo=msg.characterInfo;
        AttributesInfo attributesInfo=msg.attributesInfo;


        minecraft.setScreen(new CharacterEditScreen(Component.empty(),
                characterInfo.name,
                characterInfo.sex,
                characterInfo.race,
                characterInfo.age,
                attributesInfo
                        )


        );
    }
}
